<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="../include/admincontent.jsp" %>
<div id="Content">
    <form id="modelform" method="post" action="/SysAdmin/EditRoleAction">
        <input type="hidden" name="id" value="${role.id}" datatype="*" nullmsg="非法访问！"/>
<%--        <div class="btnbar">
            <button type="submit" class="save">保 存</button>
        </div>--%>
        <div class="toolbars">
            <a id="save">
                <em class="ico16 save_traft_16"></em>
                <span class="menu_span" title="保存">保存</span>
            </a>
        </div>
        <table class="treeTable inputform" style="margin-top: 10px">
            <tbody>
            <tr>
                <td width="80">角色名称：</td>
                <td>
                    <div><input type="text" name="rname" value="${role.rname}" datatype="*" nullmsg="角色名称不能为空！"/></div>
                </td>
            </tr>
            <tr>
                <td>角色描述：</td>
                <td>
                    <div><textarea name="remark">${role.remark}</textarea></div>
                </td>
            </tr>
            </tbody>
        </table>
    </form>
</div>
</body>
<script type="text/javascript">
    $(document).ready(function () {
        $("#save").click(function () {
            var data = {};
            data["id"] = $("input[name='id']").val();
            data["rname"] = $("input[name='rname']").val();
            data["remark"] = $("textarea[name='remark']").val();
            $.ajax({
                url: "/SysAdmin/EditRoleAction",
                type: 'POST',
                data: data,
                success: function (data) {
                    layer.msg(data.Message, {icon: 1, time: 2000});
                    setTimeout(()=>{
                        parent.location.reload();
                    }, 2000);

                },
                error: function (data) {
                    setTimeout(()=>{
                        layer.msg(data.Message, {icon: 2});
                    }, 2000);

                }
            });
        });
    });
</script>
</html>